package com.crdeng.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crdeng.business.entity.Product;
import com.crdeng.business.mapper.ProductMapper;
import com.crdeng.business.vo.ProductStockVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
public class ProductStock {

    @Resource
    private ProductMapper productMapper;

    @Test
    public void  getProductStock(){
        Page<ProductStockVO> productPage = new Page<>(1,5);
        QueryWrapper<Product> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("name", "东北大米");
        IPage<ProductStockVO> productStocks = productMapper.findProductStocks(productPage, queryWrapper);
        for (ProductStockVO record : productPage.getRecords()) {
            System.out.println(record);
        }
    }
}
